<?php

// check user login
session_start();

//echo $_SESSION["user"];




class Test_query extends CI_Controller {

	public function __construct() {
            parent::__construct(); 

	}
        
        public function index() {
            
            $variable = '12';
            
            /*
            $query = $this->doctrine->em->createQuery("select u.name from ORM\Dynasties2\Malenames u");
             $result = $query->getResult();
             print_r($result);
             
             // the above command returns: Array ( [0] => Array ( [name] => Varren ) [1] => Array ( [name] => Tyrrek ) [2] => Array ( [name] => Sarlemus ) [3] => Array ( [name] => Barrhen ) [4] => Array ( [name] => Ryzkem ) [5] => Array ( [name] => Urrim ) [6] => Array ( [name] => Nashrek ) [7] => Array ( [name] => Parnimus ) [8] => Array ( [name] => Meshka ) [9] => Array ( [name] => Johnn ) [10] => Array ( [name] => Crowen ) [11] => Array ( [name] => Demmish ) [12] => Array ( [name] => Wylum ) [13] => Array ( [name] => Heccet ) [14] => Array ( [name] => Abden ) [15] => Array ( [name] => Luccen ) [16] => Array ( [name] => Tehnik ) [17] => Array ( [name] => Gurrim ) [18] => Array ( [name] => Frederick ) [19] => Array ( [name] => Liffgem ) [20] => Array ( [name] => Wulfgang ) [21] => Array ( [name] => Bartholemew ) [22] => Array ( [name] => Hull ) [23] => Array (
            
             * 
             */
            
            $query = $this->doctrine->em->createQuery("select u.id from ORM\Dynasties2\Characters u WHERE u.whichFamily = $variable");
             $result = $query->getResult();
             print_r($result);
             
             if (empty($result)) {
                 echo "</br>Result is empty.</br>";
             } else {
                 echo "</br>Result is NOT empty.</br>";
             }
            
        }
}